import { defineStore } from "pinia";
import router from "@/router"

export const useMenuStore = defineStore('menu',{
    state:()=>({
        //从路由中获取菜单数据
        menus:router.getRoutes().filter(route=>
            route.meta && route.meta.title && route.meta.icon
        ),
        activeMenu:"/dashboard"
    }),
    actions:{
        setActiveMenu(path){
            this.activeMenu = path;
        }
    }
})